package ingsw2.ii.dp.a;

public class MyForwardIterator<T> implements MyIterator<T> {

	private int ptr;
	private MyList<T> list;
	
	public MyForwardIterator(MyList<T> list){
		this.ptr = 0;
		this.list = list;
	}
	
	@Override
	public void rewind() {
		this.ptr = 0;
	}

	@Override
	public T nextElement() {
		return list.getElement(this.ptr++);
	}

	@Override
	public boolean hasMoreElements() {
		if (this.ptr <= list.last())
			return true;
		else
			return false;
	}
}
